import Vue from 'vue';

var vueData = {
  "orderId": "201702061602372528",
  "merName": "商户测试模拟",
  "amount": "8000",
  "nper": "6",
  "unalter": "creditNo,creditName",
  "tradeDate": "2017-02-06 16:02:37",
  "returnUrl": "http://localhost:8080/allinpay-online/",
  "custName": "å¯å¯",
  "credCardno": "6259986239282080",
  "idno": "340603199402064797",
  "hpno": "17073547336",
  "cvv": "",
  "vaPerd": "",
  "simplPC": "0",
  "rateList": [{
    "nper": "6",
    "custRate": "0",
    "amtLowLimit": "1000",
    "amtUplimit": "20000",
    "poundage": "0.00",
    "eachamount": "1333.33",
    "totalamount": "8000.00"
  }, {
    "nper": "9",
    "custRate": "12",
    "amtLowLimit": "600",
    "amtUplimit": "20000",
    "poundage": "106.67",
    "eachamount": "995.55",
    "totalamount": "8960.00"
  }, {
    "nper": "12",
    "custRate": "0",
    "amtLowLimit": "600",
    "amtUplimit": "25000",
    "poundage": "0.00",
    "eachamount": "666.66",
    "totalamount": "8000.00"
  }, {
    "nper": "18",
    "custRate": "0",
    "amtLowLimit": "600",
    "amtUplimit": "20000",
    "poundage": "0.00",
    "eachamount": "444.44",
    "totalamount": "8000.00"
  }]
};

function createStagesVue() {
  var stagevue = new Vue({
    el: "#stages-box",
    data: vueData,
    computed: {

    },
    beforeMount: function() {
      console.log("createVue beforeMount 渲染前");
    },
    mounted: function() {
      console.log("createVue mounted 加载完");

    },
    components: {

    },
    methods: {

    }
  });


  return stagevue;
}

// 设置期数信息数据
function setData(infoData) {
  vueData = infoData;
}


// 设置期数下拉选项
function setSelect(rateList) {
  var rateArray = [];
  for (var i = 0, = rateList.length; i < l; i++) {
    var rateObject = {
      title: rateList[i].nper + "期",
      value: rateList[i].nper
    };
    rateArray.push(rateObject);
  }

  $("ra").select({
    title:"请选择期数",
    items:rateArray
  });
}

module.exports = {
  createStagesVue: createStagesVue,
  setData: setData,
  setSelect:setSelect
}
